﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CenyLetu
{
    class FrequentFlyerDekorator : CenaDekorator
    {
        private double naletaneKilometry;

        public FrequentFlyerDekorator(ICena c, double nk)
            : base(c)
        {
            naletaneKilometry = nk;
        }

        public override decimal GetCena()
        {
            //udava nasovky 5000 km - za kazdych 5k km - cena -10%
            int koeficient = (int)naletaneKilometry / 5000;

            //max sleva 50%
            if (koeficient > 5)
                koeficient = 5;

            double sleva = (double)koeficient / 10;

            return base.GetCena() * (decimal)(1 - sleva);
        }

    }
}
